<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="sj" tagdir="/WEB-INF/tags/spring-jquery-tags"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<link href="<c:url value='/css/tablesorter.css' />" rel="stylesheet"
	type="text/css" />
<link href="<c:url value='/css/jquery.tablesorter.pager.css' />"
	rel="stylesheet" type="text/css" />
<link href="<c:url value='/css/dhtmlxcombo_view.css' />"
	rel="stylesheet" type="text/css" />

<script type="text/javascript">
	$(document).ready(
			function() {
				$('#pageTitle').text(
						'<spring:message code="findPartnergrant.heading" />');
				$(".tablesorter").tablesorter().tablesorterPager({
					container : $("#pager")
				});

			});
	$('.view-knowledgemanagementsearch-link').click(function() {
		loadDiv('content', 'findKnowledgeManagement.do');
	});
	$('.close-button').click(function() {
		loadDiv('content', 'refreshDashboard.do');
	});
	$('.edit-partnergrant-link').click(function() {
		loadDiv('content', 'showEditPartnergrantView.do?id=' + $(this).attr('partnergrantId'));
	});
</script>
<div id="findPartnergrantDiv">
	<form:form name="editPartnergrantForm" id="editPartnergrantForm"
		action="findResultPartnergrant.do" method="post"
		modelAttribute="cipeproject">
		<form:hidden path="id" />
		<div class="main_form">
			<div class="form_head">
				<div class="floatL" style="padding-top: 5px;">
					<a href="#"
						class="view-knowledgemanagementsearch-link blue_btn floatR"><spring:message
							code="findPartnergrant.link.viewKnowledgeManagement" />
					</a>
				</div>
				<a href="javascript://" class="close-button gray_btn floatR"
					tabindex="-1">Close Form</a> <br class="clear" />
			</div>
			<div class="form_cont">
				<table cellspacing="5" width="100%">
					<tr class="row">
						<td class="input-field" colspan="5"><%@ include
								file="/common/messages.jsp"%></td>
					</tr>
				</table>
				<div id="cipeprojectListDiv" class="hastable" style="overflow: auto">
					<c:if test="${ !empty cipeprojectList}">
						<%@ include file="/common/pager.jsp"%>
					</c:if>
					<table class="tablesorter">
						<c:choose>
							<c:when test="${!empty cipeprojectList}">
								<thead>
									<c:if test="${messgae!='null'}">
										<tr>
											<th colspan="15"><font size="4"><c:out
														value="${message}"></c:out>
											</font>
											</th>
										</tr>
									</c:if>
									<!--tr><th nowrap><input type="checkbox" id="check-all">&#10;<spring:message code="common.select.all"/></th-->
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.projectID" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.projectSponsor" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.acronym" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.budget" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.disbursed" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.balance" />
									</th>
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.projectTitle" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.startDate" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.endDate" />
									</th>
									<th><spring:message
											code="partnergrantlist.table.heading.status" />
									</th>
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.ingrants" />
									</th>
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.agreement" />
									</th>
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.autho" />
									</th>
									<th nowrap><spring:message
											code="partnergrantlist.table.heading.bank" />
									</th>
									<!-- <th><spring:message code="partnergrantlist.table.heading.type"/></th>
								<th nowrap><spring:message code="partnergrantlist.table.heading.programOfficer" /></th>
								<th nowrap><spring:message code="partnergrantlist.table.heading.region" /></th>
								<th nowrap><spring:message code="partnergrantlist.table.heading.country" /></th>
								<th nowrap><spring:message code="partnergrantlist.table.heading.managementFunds" /></th> -->
									<%--<th><spring:message code="partnergrantlist.table.heading.edit" /></th> --%>
									</tr>
								</thead>
								<tbody id="partnergrid">
									<c:forEach items="${cipeprojectList}" var="cipeproject">
										<!--tr><td ><input type="checkbox" name="check_element" value="${cipeproject.id}"></td-->
										<td><a href="javascript://"
											class="edit-partnergrant-link"
											partnergrantId="${cipeproject.id}">
												${cipeproject.projectID}</a>
										</td>
										<td>${cipeproject.partner.partnerName}</td>
										<td>${cipeproject.acronym}</td>
										<%--<td><a href="javascript://" class="edit-partnergrant-link" partnergrantId="${cipeproject.id}">${cipeproject.projectID}</a></td> --%>
										<td><fmt:formatNumber type="currency"
												value="${cipeproject.partnerBudgetAmount}" pattern="$#,##0;" />
										</td>
										<td><fmt:formatNumber type="currency"
												value="${cipeproject.partnerDisbursedAmount}"
												pattern="$#,##0;" />
										</td>
										<td><fmt:formatNumber type="currency"
												value="${cipeproject.partnerBalanceAmount}"
												pattern="$#,##0;" />
										</td>
										<td>${cipeproject.projectTitle}</td>
										<td><fmt:formatDate pattern="MM-dd-yyyy"
												value="${cipeproject.projectStartDate}" />
										</td>
										<td><fmt:formatDate pattern="MM-dd-yyyy"
												value="${cipeproject.projectEndDate}" />
										</td>
										<td>${cipeproject.cipeprojectstatus.displayName}</td>
										<td>${cipeproject.receivedingrantsforapproval}</td>
										<td>${cipeproject.receiptOfSignedAgreement}</td>
										<td>${cipeproject.receiptOfSignatureAuthorization}</td>
										<td>${cipeproject.receiptOfBankInformation}</td>
										<!--<td>${cipeproject.cipeprojecttype.displayName}</td>
									<td>${cipeproject.programOfficer.fullName}</td>
									<td>${cipeproject.region.displayName}</td>
									<td>${cipeproject.country.displayName}</td>
									<td>${cipeproject.managementFunds}</td>-->
										<%--<td><a href="javascript://" class="edit-partnergrant-link" partnergrantId="${cipeproject.id}"><spring:message code="partnergrantlist.table.link.edit" /></a></td> --%>
										</tr>
									</c:forEach>

									<!--tr align="center"><td align="left" colspan="12"><input type="button" class="blue_btn" name="view" value="View Selected Grants" align="center" tabindex="-1"></td></tr-->
							</c:when>
							<c:otherwise>
								<c:set var="m" value="${message}" />
								<c:if test="${! empty m}">
									<thead>
										<tr>
											<th colspan="12"><font size="4"><c:out
														value="${message}"></c:out>
											</font>
											</th>
										<tr>
											<td colspan="14">Your query has returned 0 records</td>
										</tr>
									</thead>
								</c:if>
								<c:if test="${ !empty param.action}">
									<tr>
										<td colspan="15">Your query has returned 0 records</td>
									</tr>
								</c:if>
							</c:otherwise>
						</c:choose>
						</tbody>
					</table>
					<div id="partnergrantListPager"></div>
				</div>
			</div>
		</div>
	</form:form>
</div>
</div>